/**
 * author:Administrator
 * date:2016/1/4
 * desc:TODO
 */

'use strict';

var connedSeq = require('../conn/sequelize.js');
var Sequelize = require('sequelize');
var DataTypes = Sequelize;
var Book = require('./book.js');

var User = connedSeq.define('user',
  {
    id: {type: DataTypes.INTEGER(11), allowNull: false, primaryKey: true, autoIncrement: true},
    name: {type: DataTypes.STRING, allowNull: true}
  },
  {
    tableName: 'user',
    freezeTableName: true,
    createdAt: false,
    updatedAt: false
  });

User.hasMany(Book, {foreignKey: 'uid'});

module.exports = User;
